package com.yiji.fintech.musfinance.common.strategy.converter;

import com.yiji.fintech.musfinance.common.domain.WithdrawDomain;
import com.yiji.fintech.musfinance.common.domain.base.BaseDomain;
import com.yiji.fintech.musfinance.common.domain.channel.ChannelDomain;
import com.yiji.fintech.musfinance.common.strategy.base.AbstractContext2DomainStrategy;
import com.yiji.fintech.musfinance.common.strategy.context.TransactionContext;
import org.springframework.stereotype.Service;

/**
 * 路由渠道上线文转换WithdrawDomain
 * Created by ouwen@yiji.com} on 2017/9/26.
 */
@Service
public class Context2WithdrawDomainStrategy extends AbstractContext2DomainStrategy {
    @Override
    public void doExcute(ChannelDomain channelDomain, BaseDomain domain) {
        WithdrawDomain withdrawDomain = (WithdrawDomain) domain;
        TransactionContext context = channelDomain.getContext();
        withdrawDomain.setGatewayChannelApi(channelDomain.getInstChannelApis().get(0).getGatewayChannelApi());
        withdrawDomain.setPayBankId(context.getBfjBankId());
        withdrawDomain.setPayBankName(context.getBfjBankName());
        withdrawDomain.setPayAccountName(context.getBfjBankAccountName());
        withdrawDomain.setPayAccountNo(context.getBfjBankAccountNo());
    }
}
